Page({
  data: {
    score: 0,
    correctCount: 0,
    incorrectCount: 0,
    correctRate: '0%',
    totalQuestions: 20,
    fullScore: 100,
    scorePerQuestion: 5,
  },
  onLoad(options) {
    const score = parseInt(options.score);
    const correctCount = score / this.data.scorePerQuestion;
    const incorrectCount = this.data.totalQuestions - correctCount;
    const correctRate = ((correctCount / this.data.totalQuestions) * 100).toFixed(0) + '%';

    this.setData({
      score: score,
      correctCount: correctCount,
      incorrectCount: incorrectCount,
      correctRate: correctRate,
    });
  },
  navitorank() {
    console.log('排行榜按钮被点击了');
    wx.navigateTo({
      url: '/pages/person/Quiz-index/Quiz-rank/Quiz-rank',
    })
  },
  goHome() {
    wx.switchTab({
      url: '/pages/index/index',
    })
  }
});